#coding:utf-8
'''
Created on 2017-6-15

@author: sandy
'''

import sys,platform
sys.path.append("../")
if 'twisted.internet.reactor' not in sys.modules: 
    if platform.system() == "Linux":
        from twisted.internet import epollreactor
        epollreactor.install()  
    else:
        from twisted.internet import iocpreactor
        iocpreactor.install()   
from twisted.internet import reactor
from pycommon import remotemanager,daemon

import proxy
import accountdb
import testclient
   
def ServerStart(isdaemon):
    #accountdb.instance.start("game","root","sandy","127.0.0.1",7901,1)
    testclient.instance.start()
    pass

def ServerStop():
    #accountdb.instance.stop()
    testclient.instance.stop()
    pass

def daemonFunc(isdaemon):
    remotemanager.instance.setupLog(isdaemon)
    ServerStart(isdaemon)
    reactor.run()
    ServerStop()

def run():
    remotemanager.instance.init(0, "127.0.0.1", 0, "ProxyClient.log", "DEBUG", None)
    daemon.run("asda", daemonFunc)
    
if __name__ == "__main__":
    run()